package com.clarence.dada.modular.system.user.entity.req;


import com.clarence.dada.core.base.BaseReq;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 系统用户参数
 *
 * @author GD
 * @since 2020/11/6 15:00
 */
@Data
@Schema(title = "系统用户参数")
@EqualsAndHashCode(callSuper = true)
public class SysUserReq extends BaseReq {

    /**
     * 主键
     */
    @NotNull(message = "用户主键不能为空", groups = {edit.class, delete.class, detail.class, grantRole.class, grantData.class, resetPwd.class, changeStatus.class})
    @Schema(title = "主键", example = "1")
    private Long userId;

    /**
     * 账号
     */
    @NotBlank(message = "账号不能为空", groups = {add.class, edit.class, reg.class})
    @Schema(title = "账号", example = "admin")
    private String account;

    /**
     * 原密码
     */
    @NotBlank(message = "原密码不能为空", groups = {updatePwd.class, reg.class})
    @Schema(title = "原密码", example = "*********")
    private String password;

    /**
     * 新密码
     */
    @NotBlank(message = "新密码不能为空", groups = {updatePwd.class})
    @Schema(title = "新密码", example = "*********")
    private String newPassword;

    /**
     * 昵称
     */
    @Schema(title = "昵称", example = "梦开始得地方")
    private String nickName;

    /**
     * 姓名
     */
    @Schema(title = "姓名", example = "张三")
    private String realName;

    /**
     * 头像
     */
    @NotNull(message = "头像不能为空", groups = {updateAvatar.class})
    @Schema(title = "头像", example = "abc.png")
    private Long avatar;

    /**
     * 生日
     */
    @NotBlank(message = "生日格式不正确", groups = {add.class, edit.class})
    @Schema(title = "生日", example = "2008-01-01")
    private String birthday;

    /**
     * 性别（M-男，F-女）
     */
    @NotNull(message = "性别不能为空", groups = {updateInfo.class})
    @Schema(title = "性别", example = "M")
    private String sex;

    /**
     * 邮箱
     */
    @Email(message = "邮箱格式错误", groups = {updateInfo.class, reg.class})
    @Schema(title = "邮箱", example = "88888888@qq.com")
    private String email;

    /**
     * 手机
     */
    @NotBlank(message = "手机号码格式错误", groups = {add.class, edit.class, reg.class})
    @Schema(title = "手机", example = "18888888888")
    private String phone;

    /**
     * 电话
     */
    @Schema(title = "电话", example = "88888888")
    private String tel;

    /**
     * 授权角色，角色id集合
     */
    @NotEmpty(message = "授权角色不能为空", groups = {grantRole.class})
    @Schema(title = "授权角色,角色id集合", example = "1,2,3")
    private List<Long> grantRoleIdList;
//
//    /**
//     * 授权数据范围，组织机构id集合
//     */
//    @NotEmpty(message = "授权数据不能为空", groups = {grantData.class})
//    @Schema(title = "授权数据范围，组织机构id集合", example = "1,2,3")
//    private List<Long> grantOrgIdList;
//
//    /**
//     * 用户所属机构
//     */
//    @NotNull(message = "用户所属机构不能为空", groups = {add.class, edit.class})
//    @Schema(title = "用户所属机构", example = "1")
//    private Long orgId;
//
//    /**
//     * 用户所属机构的职务
//     */
//    @Schema(title = "用户所属机构的职务", example = "董事长")
//    private Long positionId;

    /**
     * 状态（字典 1正常 2冻结）
     */
    @NotNull(message = "状态不能为空", groups = updateStatus.class)
    @Schema(title = "状态（字典 1正常 2冻结）", example = "1")
    private Integer statusFlag;
//
//    /**
//     * 用户id集合(用在批量删除)
//     */
//    @NotEmpty(message = "用户id集合不能为空", groups = batchDelete.class)
//    @Schema(title = "用户id集合(用在批量删除)", example = "1,2,3")
//    private List<Long> userIds;
//
//    /**
//     * 部门的数据范围集合
//     */
//    @Schema(title = "部门的数据范围集合", example = "1,2,3")
//    private Set<Long> scopeOrgIds;
//
//    /**
//     * 用户id的数据范围集合
//     */
//    @Schema(title = "用户id的数据范围集合", example = "1,2,3")
//    private Set<Long> userScopeIds;

    /**
     * 参数校验分组：修改密码
     */
    public @interface updatePwd {
    }

    /**
     * 参数校验分组：重置密码
     */
    public @interface resetPwd {
    }

    /**
     * 参数校验分组：修改头像
     */
    public @interface updateAvatar {
    }

    /**
     * 参数校验分组：停用
     */
    public @interface stop {
    }

    /**
     * 参数校验分组：启用
     */
    public @interface start {
    }

    /**
     * 参数校验分组：更新信息
     */
    public @interface updateInfo {
    }

    /**
     * 参数校验分组：授权角色
     */
    public @interface grantRole {
    }

    /**
     * 参数校验分组：授权数据
     */
    public @interface grantData {
    }

    /**
     * 参数校验分组：修改状态
     */
    public @interface changeStatus {
    }

    /**
     * 参数校验分组：注册用户
     */
    public @interface reg {
    }

}


